using UnityEngine;
using UnityEngine.UI;

public class OtherTipPanel : BasePanel
{
    [Header("关闭按钮")]
    public Button closeButton;
    [Header("文本")]
    public Text myName;
    public Text myText;
    public override void OnClose()
    {
        base.OnClose();

        GameManager.Instance.canOprate=true;
    }

    public override void OnInit()
    {
        base.OnInit();
        path="UI/Panel/OtherTipPanel";
        type=PanelType.Panel;

        GameManager.Instance.canOprate=false;
    }

    public override void OnShow(params object[] par)
    {
        base.OnShow(par);
        closeButton=item.transform.Find("Close").GetComponent<Button>();
        myName=item.transform.Find("Name").GetComponent<Text>();
        myText=item.transform.Find("Text").GetComponent<Text>();

        myName.text = (string)par[0];
        JudgeText();
        closeButton.onClick.AddListener(CloseButton);
    }
    //关闭
    public void CloseButton()
    {
        Close();

        AudManager.instance.PlayUIAud(AudManager.instance.uiDic["点击"], 1);
    }
    //判断文本
    public void JudgeText()
    {
        if(myName.text=="生锈的钥匙")
        {
            myText.text="生锈的钥匙，或许可以打开某扇门或者献祭";
        }
        else if(myName.text=="红符")
        {
            myText.text="爱之名，某位商人在想着她";
        }
        else if (myName.text=="怨灵珠")
        {
            myText.text="怨灵的结晶，勇者会给你馈赠";
        }
        else if (myName.text=="超脱石")
        {
            myText.text="能够驱除魔气";
        }
        else if (myName.text=="太阳")
        {
            myText.text="正是打怪的好时候";
        }
        else if (myName.text=="血月")
        {
            myText.text="小心，怪物所有属性都会翻倍，当然，掉落金币也会翻倍";
        }
        else if(myName.text=="花")
        {
            myText.text="花总会凋零，迟来的挽留终究变成了尘埃";
        }
        else if (myName.text=="篮球")
        {
            myText.text="和鸡符咒会有很好的配合";
        }
        else if (myName.text == "终剑")
        {
            myText.text = "攻击时，额外附带一次同伤害攻击";
        }
    }
}
